import { Request, Response } from 'express';

const getPoints = (req: Request, res: Response) => {
  res.json([
    {
      id: 0,
      name: '田顾 9#',
      type: 'node',
      point: [121.55851, 30.02775],
    },
    {
      id: 1,
      name: '横河牌楼',
      type: 'node',
      point: [121.557386, 30.037642],
    },
    {
      id: 2,
      name: '西河泵站',
      type: 'node',
      point: [121.555514, 30.008775],
    },
    {
      id: 3,
      name: '思源 16#',
      type: 'node',
      point: [121.556442, 29.993086],
    },
  ]);
};
const getNodesAndLines = (req: Request, res: Response) => {
  res.json([
    {
      type: 'node',
      id: 0,
      lables: ['Asset'],
      properties: {
        metadata: {
          depth: 199,
        },
        address: '浙江省宁波市镇海区',
        name: '田顾 9#',
        coordinates: {
          crs: 'wgs-84',
          longitude: 121.55851,
          latitude: 30.02775,
          height: null,
        },
        id: 'dacd4bf2-e4b0-4793-89e0-ad62f8f71baf',
      },
    },
    {
      type: 'node',
      id: 1,
      lables: ['Asset'],
      properties: {
        metadata: {
          depth: 199,
        },
        address: '浙江省宁波市镇海区',
        name: '横河牌楼',
        coordinates: {
          crs: 'wgs-84',
          longitude: 121.557386,
          latitude: 30.037642,
          height: null,
        },
        id: '64d6165d-019e-4293-859e-e1ffbeb97aef',
      },
    },
    {
      type: 'node',
      id: 2,
      lables: ['Asset'],
      properties: {
        metadata: {
          depth: 199,
        },
        address: '浙江省宁波市镇海区',
        name: '西河泵站',
        coordinates: {
          crs: 'wgs-84',
          longitude: 121.555514,
          latitude: 30.008775,
          height: null,
        },
        id: '45e7d9f6-401f-43f0-b0ed-14c49d208b2d',
      },
    },
    {
      type: 'node',
      id: 3,
      lables: ['Asset'],
      properties: {
        metadata: {
          depth: 199,
        },
        address: '浙江省宁波市镇海区骆慈线',
        name: '思源 16#',
        coordinates: {
          crs: 'wgs-84',
          longitude: 121.556442,
          latitude: 29.993086,
          height: null,
        },
        id: '9110b657-8a3e-468f-943a-a631c1c59e2d',
      },
    },
    {
      id: 0,
      type: 'relationship',
      label: 'IS_UPSTREAM_OF',
      properties: {
        installDate: 1498348800,
      },
      start: {
        id: 0,
        labels: ['Asset'],
      },
      end: {
        id: 2,
        labels: ['Asset'],
      },
    },
    {
      id: 1,
      type: 'relationship',
      label: 'IS_UPSTREAM_OF',
      properties: {
        installDate: 1498348800,
      },
      start: {
        id: 1,
        labels: ['Asset'],
      },
      end: {
        id: 2,
        labels: ['Asset'],
      },
    },
    {
      id: 2,
      type: 'relationship',
      label: 'IS_UPSTREAM_OF',
      properties: {
        installDate: 1498348800,
      },
      start: {
        id: 2,
        labels: ['Asset'],
      },
      end: {
        id: 3,
        labels: ['Asset'],
      },
    },
  ]);
};

export default {
  'GET /api/points': getPoints,
  'GET /api/nodeslines': getNodesAndLines,
};
